<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>网上超市购物首页</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="keywords" content="网上超市购物首页">
<meta name="description" content="网上超市购物首页">
<link type="text/css" rel="stylesheet" href="<%=path%>/resources/css/shopstyle.css">
<script type="text/javascript" src="<%=path%>/resources/scripts/html5.js"></script>
<script type="text/javascript" src="<%=path%>/resources/scripts/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<%=path%>/resources/scripts/jsondata.js"></script>
</head>
<script type="text/javascript">

	 $('#subNum').live('click',subNum);
	 $('#addNum').live('click',addNum);
	 $('#shopping').live('mouseover',function(){
	 $(this).attr('style','cursor:pointer');
 });
  $('#shopping').live('click',function(){
	  var productnum = $('#productNum').text();
	  var num = $('#buyvalue').val();
	  if(parseInt(productnum) < 1)
	  {
		alert("该商品已经卖完");  
		return;
	  }
	  if(parseInt(num) > parseInt(productnum))
	  {
		  alert("该商品库存不足");
		  return;
	  }
	  
	  var productId = $('#productId').val();
	  var price = $('#proprice').text();
	
	  $.post('<%=path%>'+'/shopcart/addShopCart',{'productId' : productId,'number': num,'price': price},function(data){
		  if(data == 'success')
		  {
			  alert("商品添加成功!");
		  }
	  },'json');
	 
  });
</script>
<body>
<div class="pw">
	<header class="body_header">
		<div class="top">
			<div class="logo"><img src="<%=path%>/resources/image/logo.png"></div>
			<div class="menu">
				<br>
				9.00am<br>
				10.00pm
			</div>
		</div>
	</header>
	<section class="body_banner">
		
		<div class="swipe">
			<ul id="slider">
				<li style="display:block"><img width="100%" src="<%=path%>/resources/image/banner1.jpg"/></li>
				<li><img width="100%" src="<%=path%>/resources/image/banner2.jpg"/></li>
				<li><img width="100%" src="<%=path%>/resources/image/banner3.jpg"/></li>
				<li><img width="100%" src="<%=path%>/resources/image/banner4.jpg"/></li>
			</ul>
			<div id="pagenavi">
				<a href="javascript:void(0);" class="active">1</a>
				<a href="javascript:void(0);">2</a>
				<a href="javascript:void(0);">3</a>
				<a href="javascript:void(0);">4</a>
			</div>
		</div>
		<script type="text/javascript" src="<%=path%>/resources/scripts/touchScroll.js"></script>
		<script type="text/javascript" src="<%=path%>/resources/scripts/touchslider.dev.js"></script>
		<script type="text/javascript" src="<%=path%>/resources/scripts/run.js"></script>
		
	</section>
	<section class="body_main">
		<div class="trip" id="nav">
			<ul class="nav">
				<li><a href="list.html"><img src="<%=path%>/resources/image/nov01.png"><br>首页</a></li>
				<li><a href="about.html"><img src="<%=path%>/resources/image/nov02.png"><br>团购打折</a></li>
				<li><a href="list.html"><img src="<%=path%>/resources/image/nov03.png"><br>查看购物车</a></li>
				<li><a href="cont.html"><img src="<%=path%>/resources/image/nov04.png"><br>联系我们</a></li>
			</ul>
		</div>
		<div class="trip">
			<div class="main">
				<div class="tt">${productInfo.name}</div>
				<div class="tc">
					<div class="trip">
						<div class="leftimg"><img src="<%=path%>/resources/image/bigimg.jpg"><br><a href="<%=path%>/resources/image/big.jpg" target="_blank">点击查看大图</a></div>
						<div class="dire">
							<b>详细信息：</b><br>
							材料：冬瓜500克<br>
							调料：葱2根<br>
							做法：准备所需材料
						</div>
					</div>
					<div class="trip price">
						<div class="p_left">售价：<span id="proprice">${productInfo.price}</span><span>购买数量：<div style="font-size:16px;display:inline" id="subNum">-</div> <input type="text" id="buyvalue" style="width:50px;text-align:center;" value="1"> <div style="font-size:16px;display:inline" id="addNum">+</div></span>库存数量：<span id="productNum">${productInfo.number}</span></div>
						<div class="p_cm" id="shopping"><img src="<%=path%>/resources/image/buy.png"></div>
						<input type="hidden" value=${productInfo.id} id="productId"/>
					</div>
					<div class="trip">
						<b>灰灰小贴士：</b><br>
						◎ 海米本身就是很鲜的食材，做这道菜时也可以省略鸡精不放。<br>
						◎ 购买海米后，可以放入冰箱冷藏保存，要注意保持干燥，可以存放比较久的时间。如果不慎长虫发霉，就一定不能食用了。<br>
						◎ 泡发海米时，可以先用温水将海米洗净，然后用温水浸泡1-2小时，泡软后就可以使用了。也可以用凉水稍微泡一下，然后放入蒸锅里蒸软<br>
						<img src="<%=path%>/resources/image/big.jpg" width="100%">
					</div>
				</div>
			</div>
		</div>
	</section>
	<!-- <div class="body_footer">
		<ul>
			<li>
				<a href="index.html">
					<dl>
						<dt><img alt="返回首页" src="images/icon_1.png"></dt>
						<dd>返回首页</dd>
					</dl>
				</a>
			</li>
			<li>
				<a title="打电话" href="tel_3A//4006771971">
					<dl>
						<dt><img alt="打电话" src="images/icon_4.png"></dt>
						<dd>打电话</dd>
					</dl>
				</a>
			</li>
			<li>
				<a title="发短信" href="messages.html">
					<dl>
						<dt><img alt="发短信" src="images/icon_5.png"></dt>
						<dd>发短信</dd>
					</dl>
				</a>
			</li>					
			<li>
				<a href="../../../../map.baidu.com/mobile/#place/list/qt=s&wd=南宁市民族大道阳光100城市广场T2-13楼&vt=map/vt=map&i=8">
					<dl>
						<dt><img alt="地图" src="images/icon_3.png"></dt>
						<dd>地图</dd>
					</dl>
				</a>
			</li>
		</ul>
	</div> -->
</div>
</body>
</html>